package com.wva.common.client;

import com.wva.common.domain.vo.UserProfileVO;
import com.wva.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * TODO 内部调用失败的处理 fallbackFactory = ItemClientFallbackFactory.class
 */
@FeignClient(value = "user-service")
public interface UserClient {
    @GetMapping("/user/profile/{userId}")
    R<UserProfileVO> getBaseInfo(@PathVariable Long userId);

    /**
     * 根据用户ids获取用户昵称，key是用户id，value是用户昵称
     * @param ids
     * @return
     */
    @GetMapping("/user/rpc/get-nicknames-by-ids")
    Map<Long, String> getNicknamesByIds(@RequestParam List<Long> ids);
}
